package com.yfdice.android.bam;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.*;

public class BootBroadcastReceiver extends BroadcastReceiver 
{
	 static final String ACTION = "android.intent.action.BOOT_COMPLETED";
	 
	 @Override
	 public void onReceive(Context context, Intent intent) 
	 { 
		 if (intent.getAction().equals(ACTION))
		 {
			 boolean bAutostart = true;
			 SharedPreferences settings = context.getSharedPreferences(Settings.PREFS_NAME, 0);
			 if (settings != null)
				 bAutostart = settings.getBoolean(Settings.AUTOSTART_NAME, true); 
			 
			 if (bAutostart)
				 context.startService( new Intent( context , BAMService.class ));
		 }
	 }
}